package com.eastfair.point.transaction;

import com.eastfair.mq.model.MySimpleMessage;
import com.eastfair.mq.service.TransactionPointService;
import com.eastfair.mq.util.MessageExtUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 事务消费
 * @author: ligang
 * @date: 2022年05月01日 16:43
 */
@Slf4j
@Component
@RocketMQMessageListener(topic = "${rocketmq.consumer.transactionTopic}", consumerGroup = "${rocketmq.consumer.transactionTopicConsumer}",
//        selectorExpression = "scoreTransaction || storeTransaction ||orderTransaction ",
        messageModel = MessageModel.CLUSTERING, consumeMode = ConsumeMode.ORDERLY)
public class TransactionListner implements RocketMQListener<MySimpleMessage> {
    @Autowired
    private TransactionPointService transactionPointService;
    @Override
    public void onMessage(MySimpleMessage mySimpleMessage) {
        transactionPointService.execute(mySimpleMessage);
    }

}
